public class Helper { public int currSub = 100; public static String print(String p) { System.out.print(p); return p; } public static String arr(int p[]) { int n; String r = ""; for (n = 0; n < p.length; n++) { r += p[n] + ", "; } return r; } public static String arr(String p[]) { int n; String r = ""; for (n = 0; n < p.length; n++) { r += p[n] + "\n"; } return r; } public static String indent(int length, String s) { while ( s.length() < length ) { s = " " + s; } return s; } public static String indent(int length, int s) { String text = s + ""; while ( text.length() < length ) { text = " " + text; } return text; } public String indent(int length, double s) { // Vermeidet Gleitkommafehler, // schneidet stellen kleiner als // Cent-Beträge ab s = ( Math.floor(s * currSub) / currSub ); // s = (double)(int)( s * 100 ) / 100; String text = s + ""; if ( (s * currSub) % 10 == 0 ) { text += "0"; } if ( (currSub == 1000) && (s * currSub) % 100 == 0 ) { text += "0"; } while ( text.length() < length ) { text = " " + text; } return text; } public int dblIndent = 8; public String indent(double s) { return indent(dblIndent, s); } /* Property intIndent und stringIndent */ public int intIndent = 6; public int stringIndent = 10; /* indent-Funktionen für int und String */ public String indent(int value) { return indent(intIndent, value); } public String indent(String value) { return indent(stringIndent, value); } }